
<%@ page import="com.diaryBlogModule.Diary" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'diary.label', default: 'Diary')}" />
        <title><g:message code="default.edit.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.edit.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${diaryInstance}">
            <div class="errors">
                <g:renderErrors bean="${diaryInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post"  enctype="multipart/form-data">
                <g:hiddenField name="id" value="${diaryInstance?.id}" />
                <g:hiddenField name="version" value="${diaryInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="diaryName"><g:message code="diary.diaryName.label" default="Diary Name" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: diaryInstance, field: 'diaryName', 'errors')}">
                                    <g:textField name="diaryName" value="${diaryInstance?.diaryName}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="diaryInfo"><g:message code="diary.diaryInfo.label" default="Diary Info" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: diaryInstance, field: 'diaryInfo', 'errors')}">
                                    <g:textField name="diaryInfo" value="${diaryInstance?.diaryInfo}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="diaryType"><g:message code="diary.diaryType.label" default="Diary Type" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: diaryInstance, field: 'diaryType', 'errors')}">
                                    <g:select name="diaryType.id" from="${com.diaryBlogModule.DiaryType.list()}" optionKey="id" value="${diaryInstance?.diaryType?.id}"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="image"><g:message code="diary.image.label" default="Image" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: diaryInstance, field: 'image', 'errors')}">
                                    <input type="file" id="image" name="image" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="diaryEntity"><g:message code="diary.diaryEntity.label" default="Diary Entity" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: diaryInstance, field: 'diaryEntity', 'errors')}">
                                    
<ul>
<g:each in="${diaryInstance?.diaryEntity?}" var="d">
    <li><g:link controller="diaryEntity" action="show" id="${d.id}">${d?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="diaryEntity" action="create" params="['diary.id': diaryInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'diaryEntity.label', default: 'DiaryEntity')])}</g:link>

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="lastUpdate"><g:message code="diary.lastUpdate.label" default="Last Update" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: diaryInstance, field: 'lastUpdate', 'errors')}">
                                    <g:datePicker name="lastUpdate" precision="day" value="${diaryInstance?.lastUpdate}"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="dateCreated"><g:message code="diary.dateCreated.label" default="Date Created" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: diaryInstance, field: 'dateCreated', 'errors')}">
                                    <g:datePicker name="dateCreated" precision="day" value="${diaryInstance?.dateCreated}"  />
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
